package cn.saas.test;


import org.greenrobot.greendao.annotation.Convert;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.ToMany;
import org.greenrobot.greendao.annotation.Transient;

import java.util.List;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.DaoException;
import cn.saas.test.greendao.gen.DaoSession;
import cn.saas.test.greendao.gen.HoleBeanDao;
import cn.saas.test.greendao.gen.TowerBeanDao;

/**
 * @Title :
 * @date : 2021/5/28 18:17
 */
@Entity(nameInDb = "tower_info")
public class TowerBean {

    @Id(autoincrement = true)
    private Long id;

    // ("projectpk")
    private String projectpk;

    // 塔位编号
    // ("towerCode")
    private String towerCode;

    //塔位主键
    // ("towerpk")
    private String towerpk;

    // 高程m
    // ("altitude")
    private Double altitude;

    // 创建时间
    // ("createTime")
    private String createTime;

    // 创建人
    // ("createUser")
    private String createUser;

    // 地貌单元
    @Transient
    // ("landform")
    private String landform;

    // 修改时间
    // ("updateTime")
    private String updateTime;

    // 修改人
    // ("updateUser")
    private String updateUser;

    //
    // ("orgpk")
    private String orgpk;

    // 详细地址
    // ("address")
    private String address;

    @Transient
    // ("x")
    private Double x;
    @Transient
    // ("y")
    private Double y;
    // ("latitude")
    private Double latitude;
    // ("longitude")
    private Double longitude;
    // 描述
    // ("remark")
    private String remark;

    // 塔顺序
    // ("towerSeq")
    private Integer towerSeq;

    // 状态 0：未开始 1：已开始 2：已结束
    // ("status")
    private Integer status;


    // 里程
    @Transient
    // ("mileage")
    private Double mileage;
    //斜半根开
    @Transient
    // ("towerCompute")
    private Double towerCompute;
    // 塔位类型 1：直线 2：转角 3：终端 4：耐张
    @Transient
    // ("towerType")
    private int towerType;

    @ToMany(referencedJoinProperty = "holeId")
    @Convert(columnType = String.class, converter = HoleVoConvert.class)
    private List<HoleBean> holeBeans;

    /** Used to resolve relations */
    @Generated(hash = 2040040024)
    private transient DaoSession daoSession;

    /** Used for active entity operations. */
    @Generated(hash = 1154988382)
    private transient TowerBeanDao myDao;

    @Override
    public String toString() {
        return "TowerBean{" +
                "id=" + id +
                ", projectpk='" + projectpk + '\'' +
                ", towerCode='" + towerCode + '\'' +
                ", towerpk='" + towerpk + '\'' +
                ", altitude=" + altitude +
                ", createTime='" + createTime + '\'' +
                ", createUser='" + createUser + '\'' +
                ", landform='" + landform + '\'' +
                ", updateTime='" + updateTime + '\'' +
                ", updateUser='" + updateUser + '\'' +
                ", orgpk='" + orgpk + '\'' +
                ", address='" + address + '\'' +
                ", x=" + x +
                ", y=" + y +
                ", latitude=" + latitude +
                ", longitude=" + longitude +
                ", remark='" + remark + '\'' +
                ", towerSeq=" + towerSeq +
                ", status=" + status +
                ", mileage=" + mileage +
                ", towerCompute=" + towerCompute +
                ", towerType=" + towerType +
                ", holeBeans=" + holeBeans +
                ", daoSession=" + daoSession +
                ", myDao=" + myDao +
                '}';
    }

    @Generated(hash = 1982360156)
    public TowerBean(Long id, String projectpk, String towerCode, String towerpk,
            Double altitude, String createTime, String createUser,
            String updateTime, String updateUser, String orgpk, String address,
            Double latitude, Double longitude, String remark, Integer towerSeq,
            Integer status) {
        this.id = id;
        this.projectpk = projectpk;
        this.towerCode = towerCode;
        this.towerpk = towerpk;
        this.altitude = altitude;
        this.createTime = createTime;
        this.createUser = createUser;
        this.updateTime = updateTime;
        this.updateUser = updateUser;
        this.orgpk = orgpk;
        this.address = address;
        this.latitude = latitude;
        this.longitude = longitude;
        this.remark = remark;
        this.towerSeq = towerSeq;
        this.status = status;
    }

    @Generated(hash = 849194740)
    public TowerBean() {
    }

    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getProjectpk() {
        return this.projectpk;
    }

    public void setProjectpk(String projectpk) {
        this.projectpk = projectpk;
    }

    public String getTowerCode() {
        return this.towerCode;
    }

    public void setTowerCode(String towerCode) {
        this.towerCode = towerCode;
    }

    public String getTowerpk() {
        return this.towerpk;
    }

    public void setTowerpk(String towerpk) {
        this.towerpk = towerpk;
    }

    public Double getAltitude() {
        return this.altitude;
    }

    public void setAltitude(Double altitude) {
        this.altitude = altitude;
    }

    public String getCreateTime() {
        return this.createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getCreateUser() {
        return this.createUser;
    }

    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }

    public String getUpdateTime() {
        return this.updateTime;
    }

    public void setUpdateTime(String updateTime) {
        this.updateTime = updateTime;
    }

    public String getUpdateUser() {
        return this.updateUser;
    }

    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }

    public String getOrgpk() {
        return this.orgpk;
    }

    public void setOrgpk(String orgpk) {
        this.orgpk = orgpk;
    }

    public String getAddress() {
        return this.address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public Double getLatitude() {
        return this.latitude;
    }

    public void setLatitude(Double latitude) {
        this.latitude = latitude;
    }

    public Double getLongitude() {
        return this.longitude;
    }

    public void setLongitude(Double longitude) {
        this.longitude = longitude;
    }

    public String getRemark() {
        return this.remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Integer getTowerSeq() {
        return this.towerSeq;
    }

    public void setTowerSeq(Integer towerSeq) {
        this.towerSeq = towerSeq;
    }

    public Integer getStatus() {
        return this.status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    /**
     * To-many relationship, resolved on first access (and after reset).
     * Changes to to-many relations are not persisted, make changes to the target entity.
     */
    @Generated(hash = 1753496636)
    public List<HoleBean> getHoleBeans() {
        if (holeBeans == null) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            HoleBeanDao targetDao = daoSession.getHoleBeanDao();
            List<HoleBean> holeBeansNew = targetDao._queryTowerBean_HoleBeans(id);
            synchronized (this) {
                if (holeBeans == null) {
                    holeBeans = holeBeansNew;
                }
            }
        }
        return holeBeans;
    }

    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    @Generated(hash = 315373449)
    public synchronized void resetHoleBeans() {
        holeBeans = null;
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 128553479)
    public void delete() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.delete(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 1942392019)
    public void refresh() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.refresh(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 713229351)
    public void update() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.update(this);
    }

    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 895271227)
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getTowerBeanDao() : null;
    }
}
